var utils = require('../../utils/util.js')
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrl: "",
    add: "",
    lists: [],
    wid: '',
    imgsrv: app.globalData.srvlink + '/diancan/img/',
  },
  onLoad: function (s) {
    var that = this
    wx.showLoading();
    var id = wx.getStorageSync("openId");
    wx.request({
      url: app.globalData.srvlink + '/diancan/orderList/' + id,
      method: 'GET',
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        wx.hideLoading()
        if (res.data.data == null || res.data.data.length == 0) {
          that.setData({
            imgUrl: "../../imgs/car.png",
            add: "订单是空的！~",
            wid: '0',
            lists: ''
          });
        } else {
          var dataList = res.data.data
          for (var i = 0; i < dataList.length; i++) {
            dataList[i].addTime = utils.formatTime(dataList[i].addTime)
          }
           

          that.setData({
            imgUrl: "",
            add: '',
            lists: dataList,
            wid: "100%",
            hei: "100rpx",
          })
        }


      }
    })
  },

   
})